<?
#####################################################
#  COPYRIGHT NOTICE
#####################################################
# In the following statements, the term "this 
# program" refers to all files associated with the
# execution and distribution of Adtrackz.
#
# This Program is Copyright 2004 Jonah Klimack.
# All Rights Reserved. 
#
# Selling the code for this program, modifying 
# and/or redistributing the code for this program
# in part or in whole over the Internet or in any 
# other medium is expressly forbidden. Violators
# will be prosecuted to the fullest extent of the law
# Copyright and header information may not be
# modified.
#
# This program is distributed "as is" and without 
# warranty of any kind, either express or implied.
# In no event shall the liability of Jonah Klimack 
# for any damages, losses and/or causes of 
# action exceed the total amount paid by the 
# user for this software.		
#####################################################
# DO NOT MODIFY ANYTHING IN THIS FILE
#####################################################



if (file_exists("variables.php"))
	require "variables.php";

extract($_REQUEST);

mysql_connect($sqlserver,$sqluser,$sqlpass) or alert("AdtrackzGold couldn't connect to the mysql server.");
mysql_select_db($sqldb) or alert("AdtrackzGold couldn't select the mysql database.");

//given 2 dates returns the earliest one 
//takes it in this format: y-m-d hh:mm:ss
function earlier_date ($date1, $date2)
{
	$time1 = strtotime($date1);
	$time2 = strtotime($date2);
	if ($time1 < $time2) //date1 happened before date2 so return that
		return $date1;
	elseif ($time1 > $time2) //date2 happened before date1
		return $date2;
}

function error($error)
{
	echo "<table border=1 width=400 cellspacing=0 cellpadding=5 align=center bordercolor=#0F87BE><tr><td class=tbhead2>Error</td></tr><tr><td><table width=100% cellpadding=5><tr><td>";
	echo "Please correct the following error:<br><br>$error";
	echo "</td></tr></table></td></tr></table>";
}

function fatal_error($error)
{
	echo "<table border=1 width=400 cellspacing=0 cellpadding=5 align=center bordercolor=#0F87BE><tr><td class=tbhead2>Fatal Error</td></tr><tr><td><table width=100% cellpadding=5><tr><td>";
	echo "AdtrackzGold encountered a fatal error:<br><br>$error<br><br>Please try again, or contact <a href=http://adtrackzgold.com target=_sup>support</a> if the problem persists.";
	echo "</td></tr></table></td></tr></table>";
	require "footer.php";
	exit;
}

function alert($msg)
{
	echo "<table border=1 width=400 cellspacing=0 cellpadding=5 align=center bordercolor=#0F87BE><tr><td class=tbhead2>Alert</td></tr><tr><td><table width=100% cellpadding=5><tr><td>";
	echo $msg;
	echo "</td></tr></table></td></tr></table>";
}

function getmtime()
{
	$a = explode (' ',microtime());
	return(double) $a[0] + $a[1];
}



?>